﻿using UnityEngine;
using System.Collections.Generic;

public class Match
{
	/// <summary>
	/// The creator.
	/// </summary>
	private User creator;
	public User Creator
	{
		get { return creator; }
	}

	/// <summary>
	/// The name of the match.
	/// </summary>
	private string matchName;
	public string Name
	{
		get { return matchName; }
	}

	/// <summary>
	/// The match players.
	/// </summary>
	private List<User> matchPlayers;
	public List<User> Players
	{
		get { return matchPlayers; }
	}

	/// <summary>
	/// The question.
	/// </summary>
	private string question = string.Empty;
	public string Question { get { return question; } set { question = value; } }

	/// <summary>
	/// The answers.
	/// </summary>
	private List<string> answers = new List<string>();
	public List<string> Answers { get { return answers; } set { answers = value; } }

	/// <summary>
	/// The selected answer.
	/// </summary>
	private string selectedAnswer = string.Empty;
	public string SelectedAnswer { get { return selectedAnswer; } set { selectedAnswer = value; } }

	/// <summary>
	/// The type.
	/// </summary>
	private Constants.MatchTypes type;

	/// <summary>
	/// Initializes a new instance of the <see cref="Match"/> class.
	/// </summary>
	/// <param name="creator">Creator.</param>
	/// <param name="matchName">Match name.</param>
	/// <param name="type">Type.</param>
	public Match(User creator, string matchName, Constants.MatchTypes type)
	{
		this.creator = creator;
		this.matchName = matchName;
		this.type = type;
		matchPlayers = new List<User>();

		Debug.Log ("Creator: " + this.creator.Nick);
		Debug.Log ("Name:" + matchName);
	}

	/// <summary>
	/// Gets the type.
	/// </summary>
	/// <returns>The type.</returns>
	public Constants.MatchTypes GetMatchType()
	{
		return type;
	}

	/// <summary>
	/// Adds the user.
	/// </summary>
	/// <param name="user">User.</param>
	public void AddUser(User user)
	{
		matchPlayers.Add(user);
	}
}
